package exception;

import exception2.IllegalAgeException;

public class ThrowDemo {
    public static void main(String[] args)   {
        /*
        Student zs = new Student();
        zs.setAge(1000);
        System.out.println("此人的年龄为:"+zs.getAge()+"岁");
         */

        Student zs = new Student();

        try{
            int a=1/0;
            zs.setAge(1000);
            System.out.println("此人的年龄为:"+zs.getAge()+"岁");

        }catch( IllegalAgeException |ArithmeticException e){
            System.out.println(e);
            System.out.println(e.getMessage());
            System.out.println("年龄不合法");
        }

    }
}
